const fs = require('fs')
const path = require('path')

const generatorSpace = (count) => new Array(count).join(' ')

const noRepeadFileName = () => {}

console.log(generatorSpace(3))

function readdirectory(dir) {
	let files = fs.readdirSync(dir)
	let dir = 0
	files.forEach((item) => {
		let filepath1 = dir + '/' + item
		// let filepath1 = item
		let stat = fs.statSync(filepath1)
		if (stat.isFile()) {
			console.log(`|-${dir.split('../')[1]}|-${item}`)
			// console.log(path.basename(filepath1))
		} else {
			readdirectory(filepath1)
		}
	})
}
//要读取的目录
readdirectory('../day5')
// console.log(path.join(__dirname, '../day5'))
